# Maintainer: Mohd Syazli Mahmud <syazli7@yahoo.com>
pkgname=mythtv
pkgver=0.21.1
#pkgver=19930
pkgrel=1
pkgdesc="A Homebrew PVR project."
arch=('i686' 'x86_64')
url="http://svn.mythtv.org/trac/"
source=('mythbackend')
depends=('directfb' 'bash' 'mysql-clients>=5.0' 'lame' 'qt3' 'lirc-utils' 'ffmpeg' 'libxvmc' 'perl-crypt-ssleay')
provides=('mythtv')
groups=('pvr')
license=('GPL')
md5sums=('7ef6de58240e7aad389a0b13d91b1cf6')
options=()

build() {
  [ "$CARCH" = "i686"   ] && ARCH="i686"
  [ "$CARCH" = "x86_64" ] && ARCH="x86-64"
    install -Dm755 $startdir/mythbackend $startdir/pkg/etc/rc.d/mythbackend || return 1

    msg "Starting make..."

    ##Start build
    rm -Rf $startdir/src/$pkgname
    mkdir -p $startdir/src
    cp $startdir/${pkgname}-${pkgver}.tar.bz2 $startdir/src
    cd $startdir/src
    tar -jxf ${pkgname}-${pkgver}.tar.bz2
    rm ${pkgname}-${pkgver}.tar.bz2
    cd $startdir/src/$pkgname

./configure --prefix=/usr --enable-libmp3lame --enable-libvorbis \
--enable-libxvid --extra-cflags="-I/usr/lib/ -L/usr/include/" \
--extra-cxxflags="-I/usr/lib/ -L/usr/include/" \
--extra-ldflags="-I/usr/lib/ -L/usr/include/" --enable-mmx --enable-audio-oss \
--enable-audio-alsa --enable-audio-jack --enable-lirc --disable-joystick-menu \
--enable-firewire --enable-iptv --disable-dbox2 --disable-hdhomerun \
--enable-v4l --enable-ivtv --enable-dvb --dvb-path=/usr/include \
--enable-xrandr --enable-xv --enable-xvmc --enable-xvmc --enable-xvmcw \
--enable-xvmc-pro --enable-xvmc-vld --enable-opengl-video \
--enable-opengl-vsync --disable-mac-bundle --disable-directfb \
--runtime-prefix=/usr --enable-ffmpeg \
--enable-libfaad --enable-libfftw3 --enable-fribidi || return 1
#--enable-libx264

    ## start make
    /opt/qt/bin/qmake mythtv.pro || return 1
    make || return 1

    make INSTALL_ROOT=$startdir/pkg install || return 1

    # install contrib
    mkdir -p $startdir/pkg/usr/share/mythtv/contrib || return 1
    install -m0755 contrib/* $startdir/pkg/usr/share/mythtv/contrib

    rm -Rf $startdir/src/$pkgname
    }
